package util;
import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JToolBar;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JWindow;
import javax.swing.JTabbedPane;
import javax.swing.JList;
import java.awt.GridBagLayout;
import javax.swing.JSplitPane;
import java.awt.GridBagConstraints;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.util.Iterator;

import javax.swing.JComboBox;
import javax.swing.JTextPane;
import javax.swing.JToggleButton;
import javax.swing.JScrollPane;
import javax.swing.table.TableColumn;
import javax.swing.JTree;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import javax.swing.JScrollBar;

public class GUI extends JFrame {

	private static final long serialVersionUID = 1L;
	
	private JPanel jContentPane = null;
	private JTabbedPane jTabbedPane = null;
	private JPanel jPanelMain = null;
	private JPanel jPanelConfig = null;
	private JPanel jPanelLog = null;
	
	private JLabel lblMillParks = null;
	private JComboBox cbMillParks = null;
	private JLabel lblParkInfo = null;
	private JTextPane tbParkInfo = null;
	private JLabel lblMills = null;
	private JScrollPane jScrollPane = null;
	private JTable tblMills = null;

	private JTree jConfigTree = null;

	private JPanel configOption = null;

	private JTextField jTextField2 = null;

	private JScrollPane jScrollPane1 = null;

	private JTable tblLogView = null;

	private JButton btnRefresh = null;

	/**
	 * This is the default constructor
	 */
	public GUI() {
		super();
		initialize();
	}
	
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(1000, 700);
		this.setContentPane(getJContentPane());
		this.setTitle("SCADA Client");
		
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	public JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getJTabbedPane(), BorderLayout.CENTER);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	public JTabbedPane getJTabbedPane() {
		if (jTabbedPane == null) {
			jTabbedPane = new JTabbedPane();
			jTabbedPane.addTab("Main", null, getJPanelMain(), null);
			jTabbedPane.addTab("Config", null, getJPanelConfig(), null);
			jTabbedPane.addTab("Log", null, getJPanelLog(), null);
			
		}
		return jTabbedPane;
	}

	/**
	 * This method initializes jPanelMain	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public JPanel getJPanelMain() {
		if (jPanelMain == null) {
			lblMills = new JLabel();
			lblMills.setBounds(new Rectangle(255, 13, 706, 16));
			lblMills.setText("Mills");
			lblParkInfo = new JLabel();
			lblParkInfo.setBounds(new Rectangle(30, 75, 211, 16));
			lblParkInfo.setText("Windmill Park Info");
			lblMillParks = new JLabel();
			lblMillParks.setBounds(new Rectangle(30, 15, 210, 16));
			lblMillParks.setText("Windmill Parks");
			jPanelMain = new JPanel();
			jPanelMain.setLayout(null);
			jPanelMain.add(lblMillParks, null);
			jPanelMain.add(getCbMillParks(), null);
			jPanelMain.add(lblParkInfo, null);
			jPanelMain.add(getTbParkInfo(), null);
			jPanelMain.add(lblMills, null);
			jPanelMain.add(getJScrollPane(), null);
			jPanelMain.add(getBtnRefresh(), null);
		}
		return jPanelMain;
	}

	/**
	 * This method initializes jPanelMain	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public JPanel getJPanelConfig() {
		if (jPanelConfig == null) {
			jPanelConfig = new JPanel();
			jPanelConfig.setLayout(null);
			jPanelConfig.add(getJConfigTree(), null);
			jPanelConfig.add(getConfigOption(), null);
		}
		return jPanelConfig;
	}

	public JPanel getJPanelLog() {
		if (jPanelLog == null) {
			jPanelLog = new JPanel();
			jPanelLog.setLayout(new BorderLayout());

			jPanelLog.add(getJScrollPane1(), BorderLayout.NORTH);
		}
		return jPanelLog;
	}
	
	/**
	 * This method initializes cbMillParks	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	public JComboBox getCbMillParks() {
		if (cbMillParks == null) {
			cbMillParks = new JComboBox();
			cbMillParks.setBounds(new Rectangle(30, 30, 211, 25));
		}
		return cbMillParks;
	}

	/**
	 * This method initializes tbParkInfo	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	public JTextPane getTbParkInfo() {
		if (tbParkInfo == null) {
			tbParkInfo = new JTextPane();
			tbParkInfo.setBounds(new Rectangle(30, 90, 211, 361));
		}
		return tbParkInfo;
	}

	/**
	 * This method initializes jScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	public JScrollPane getJScrollPane() {
		if (jScrollPane == null) {
			jScrollPane = new JScrollPane();
			jScrollPane.setBounds(new Rectangle(255, 30, 706, 419));
			jScrollPane.setViewportView(getTblMills());
		}
		return jScrollPane;
	}

	/**
	 * This method initializes tblMills	
	 * 	
	 * @return javax.swing.JTable	
	 */
	public JTable getTblMills() {
		if (tblMills == null) {
			tblMills = new JTable();
			
		}
		return tblMills;
	}

	/**
	 * This method initializes jConfigTree	
	 * 	
	 * @return javax.swing.JTree	
	 */
	public JTree getJConfigTree() {
		if (jConfigTree == null) {
			jConfigTree = new JTree();
			jConfigTree.setBounds(new Rectangle(15, 15, 241, 601));
		}
		return jConfigTree;
	}

	/**
	 * This method initializes configOption	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public JPanel getConfigOption() {
		if (configOption == null) {
			configOption = new JPanel();
			configOption.setLayout(null);
			configOption.setBounds(new Rectangle(495, 15, 466, 601));
		}
		return configOption;
	}

	/**
	 * This method initializes jScrollPane1	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getJScrollPane1() {
		if (jScrollPane1 == null) {
			jScrollPane1 = new JScrollPane();
			
			jScrollPane1.setViewportView(getTblLogView());
		}
		return jScrollPane1;
	}

	/**
	 * This method initializes tblLogView	
	 * 	
	 * @return javax.swing.JTable	
	 */
	public JTable getTblLogView() {
		if (tblLogView == null) {
			tblLogView = new JTable();
		}
		return tblLogView;
	}

	/**
	 * This method initializes btnRefresh	
	 * 	
	 * @return javax.swing.JButton	
	 */
	public JButton getBtnRefresh() {
		if (btnRefresh == null) {
			btnRefresh = new JButton("Refresh");
			btnRefresh.setBounds(new Rectangle(31, 464, 211, 61));
			
		}
		return btnRefresh;
	}
}


